
var datagrid = require('datagrid');
var router = require('router');
var request = require('request');
var template = require('template');
var tpl = require('../../views/message/suggest');
var layout = require('../../views/message/layout');
var placeholder = require('placeholder');
var layer = require('layer');
var util = require('util');

return extend('./main', {
    target:'#suggestion',
    path:'/suggest/',
    template:{
        main:layout,
        body:tpl
    },
    events:{
        'click .ui-button':'submit'
    },
    submit:function(){
        var data = util.getData(this.element.find('form')).result;
        if(!data.title){
            layer.message('error', '请输入反馈标题')
            return
        }
        if(!data.content){
            layer.message('error', '请输入反馈内容')
            return
        }
        request.postUpdate('user.json', data, {
            200:function(res){
                
            }
        })
    }
})